package com.breaktian.assemble.customviews.dialog;

import android.content.Context;

import com.breaktian.assemble.R;

/**
 * Created by keke.tian on 2017/9/6.
 */

public class LoadingDialogUtils {
    static LoadingDialog mDialog;
    public static void show(Context context){
        try {
            if (mDialog==null || !mDialog.isShowing()) {
                mDialog = new LoadingDialog(context, R.style.BmCustomDialog);
                mDialog.show();
            }
        } catch (Exception e) {
            e.printStackTrace();
            mDialog = null;
        } catch (Error error) {
            error.printStackTrace();
            mDialog = null;
        }
    }

    public static void dismiss() {
        try {
            if (mDialog != null) {
                mDialog.dismiss();
            }
            mDialog = null;
        } catch (Exception e) {
            e.printStackTrace();
            mDialog = null;
        } catch (Error error) {
            error.printStackTrace();
            mDialog = null;
        }

    }

}
